/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
  CCell, Cell, Table, TableBody, TableRow, Text, TableHead, useTheme, RCell,
} from "customize-easy-ui-component";
import {eqpTypeAllMap} from "../../dict/eqpComm";
import {DirectLink} from "../../routing/Link";
import {multilines2Html} from "../tools";
import Img_Seal from "../../images/seal.png";
import {CCellUnit} from "../common/base";
import {item宏观检验o} from "./editorMacr";
import {item资料审查o} from "./editorReview";

//承压的相似度更高点
export const 宏观检验报告= ({theme, orc, rep} :{theme: any, orc:any, rep:any}
) => {
  return <>
    <div css={{
      display: 'flex',
      justifyContent: 'space-between'
    }}>
      <Text>单位内部编号：{orc.单位内部编号}</Text>
      <Text>报告编号：{rep.isp.no}</Text>
    </div>
    <Table fixed={["3.5%", "6%", "20%", "13%", "%", "8%"]} css={{borderCollapse: 'collapse'}} tight  miniw={800}>
      <TableHead>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/ALL`}>
          <TableRow>
            <CCell><Text css={{fontSize:'0.6rem'}}>序号</Text></CCell><CCell colSpan={2}>检 验 项 目</CCell><CCell>检验结果</CCell><CCell>备注</CCell><CCell>等级评定</CCell>
          </TableRow>
        </DirectLink>
      </TableHead>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Structural#Structural`}>
          { item宏观检验o.map(([name,conf,adddesc]: any, i:number) => {
            const {t: title, pr: prefix, span}=conf;          //从模型提取参数
            return <TableRow key={i}>
                <CCell>{i+1}</CCell>
                {prefix && <CCell rowSpan={span??1}>{prefix}</CCell>}
                <CCell>{adddesc? orc?.[name]?.a??'／' : title}</CCell>
                <CCell>{orc?.[name]?.r??'／'}</CCell>
                <CCell>
                  {multilines2Html(orc?.[name]?.m??'／', (txt, i) => {
                    return <React.Fragment key={i}>{(i!==0)&&<br/>}<Text css={{whiteSpace:'break-spaces'}}>{txt}</Text></React.Fragment>
                  })}
                </CCell>
                <CCell>{orc?.[name]?.c??'／'}</CCell>
              </TableRow>
          }) }
          <TableRow>
            <Cell colSpan={6}>结果：表中检验项目备注无法说明清楚的，可在本栏中进一步将缺陷（问题）情况描述清楚。<br/>
              {multilines2Html(orc.宏观结果 || '／', (txt, i) => {
                return <React.Fragment key={i}>{(i!==0)&&<br/>}<Text css={{whiteSpace:'break-spaces'}}>{txt}</Text></React.Fragment>
              })}
            </Cell>
          </TableRow>
        </DirectLink>
      </TableBody>
    </Table>
    <Table fixed={ ["62%","%"]  }  css={ {borderCollapse: 'collapse' } } tight  miniw={800}>
      <TableBody>
        <TableRow>
          <CCell><div css={{height: '100%',display: 'flex',justifyContent: 'space-between',alignContent: 'space-between',alignItems: 'flex-start'}}>
            <div><Text>检验：</Text>    </div>
            <div css={{textAlign: 'end'}}><Text >日期</Text>2022-12-31</div>
          </div></CCell>
          <CCell><div css={{height: '100%',display: 'flex',justifyContent: 'space-between',alignContent: 'space-between',alignItems: 'flex-start'}}>
            <div><Text >审核：</Text>  </div>
            <div css={{textAlign: 'end'}}><Text >日期</Text>2021-01-31</div>
          </div></CCell>
        </TableRow>
      </TableBody>
    </Table>
  </>;
};

